package com.rxyb.security.handler;

import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author YJH
 * @version 1.0
 * @description 用户权限不足 1处理器
 * @date 2020/5/16  14:00
 */
public class AuthLimitHandler implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
        System.out.println("用户权限不足 " + request.getRequestURI());
        response.sendRedirect("/limit");
    }
}
